<?php
/**
 * @author    NinoTheme.com http://www.ninotheme.com
 * @copyright Copyright (C) 2013 - 2014 NinoTheme.com. All rights reserved.
 * @license   NinoTheme.com Proprietary License
 */

function nino_contact_pro_admin () {
	include('admin/contact-basic-form.php');
	
	echo ob_get_clean();
}

function nino_contact_form_builder() {
	include('admin/contact-form-builder.php');
	
	echo ob_get_clean();
}

function demo_contact_form_builder() {
	include('admin/demo/demo-contact-form-builder.php');
	
	echo ob_get_clean();
}

function nino_contact_pro_admin_actions() {
	$home = add_menu_page('Nino Contact Pro', 'Nino Contact Pro', 'manage_options', 'nino_contact_pro_admin', 'nino_contact_pro_admin');
	$form = add_submenu_page('nino_contact_pro_admin', 'Nino Contact Form Builder', 'Contact Form Builder', 'manage_options', 'nino_contact_form_builder', 'nino_contact_form_builder');
	$demoform = add_submenu_page('nino_contact_pro_admin', 'Demo Contact Form Builder', 'Demo Contact Form Builder', 'manage_options', 'demo_contact_form_builder', 'demo_contact_form_builder');
	add_action('admin_print_scripts-'.$home, 'nino_contact_pro_admin_load_scripts');
	add_action('admin_print_scripts-'.$form, 'nino_contact_pro_admin_form_builder_load_scripts');
	add_action('admin_print_scripts-'.$demoform, 'demo_contact_pro_admin_form_builder_load_scripts');
}

function nino_contact_pro_enqueue_front_scripts() {
	wp_enqueue_style('nino-contact-pro-style', NINO_CONTACT_PRO_URL . 'includes/assets/css/nino-contact-form-pro.css');
	wp_enqueue_style('nino-contact-pro-font-style', NINO_CONTACT_PRO_URL . 'includes/assets/css/nino-font-awesome.min.css');
	wp_enqueue_script('bootstrap-script', NINO_CONTACT_PRO_URL . 'includes/assets/js/bootstrap.min.js');
}

function nino_contact_pro_admin_load_scripts() {
	nino_contact_pro_enqueue_front_scripts();
	
	wp_enqueue_style('nino-contact-pro-admin-style', NINO_CONTACT_PRO_URL . 'includes/assets/css/style.css');
	wp_enqueue_script(array('jquery','jquery-ui-core','jquery-ui-sortable', 'jquery-ui-accordion','jquery-ui-slider', 'jquery-ui-draggable', 'jquery-ui-droppable'));
	
	/* Color picker */
	wp_enqueue_style('nino-contact-pro-color-picker', NINO_CONTACT_PRO_URL . 'includes/assets/css/colpick.css');
	wp_enqueue_script('nino-contact-pro-color-picker-script', NINO_CONTACT_PRO_URL . 'includes/assets/js/colpick.js');
	
	/* Font icon picker */
	wp_enqueue_style('nino-contact-pro-icon-picker', NINO_CONTACT_PRO_URL . 'includes/assets/css/jquery.fonticonpicker.css');
	wp_enqueue_style('nino-contact-pro-icon-font-fontello', NINO_CONTACT_PRO_URL . 'includes/assets/css/fontello.css');
	wp_enqueue_style('nino-contact-pro-icon-font-icomoon', NINO_CONTACT_PRO_URL . 'includes/assets/css/icomoon.css');
	
	wp_enqueue_style('nino-contact-pro-icon-theme-grey', NINO_CONTACT_PRO_URL . 'includes/assets//themes/grey-theme/jquery.fonticonpicker.grey.min.css');
	wp_enqueue_style('nino-contact-pro-icon-theme-darkgrey', NINO_CONTACT_PRO_URL . 'includes/assets/themes/dark-grey-theme/jquery.fonticonpicker.darkgrey.min.css');
	wp_enqueue_style('nino-contact-pro-icon-theme-bootstrap', NINO_CONTACT_PRO_URL . 'includes/assets/themes/bootstrap-theme/jquery.fonticonpicker.bootstrap.min.css');
	wp_enqueue_style('nino-contact-pro-icon-theme-inverted', NINO_CONTACT_PRO_URL . 'includes/assets/themes/inverted-theme/jquery.fonticonpicker.inverted.min.css');
	
	wp_enqueue_script('nino-contact-pro-icon-picker-script', NINO_CONTACT_PRO_URL . 'includes/assets/js/jquery.fonticonpicker.min.js');
	
	/* Jquery JSON */
	wp_enqueue_script('nino-contact-pro-json', NINO_CONTACT_PRO_URL . 'includes/assets/js/jquery.json.js');
}

function nino_contact_pro_admin_form_builder_load_scripts() {
	nino_contact_pro_admin_load_scripts();
	
	wp_enqueue_script('nino-contact-pro-libraries-script', NINO_CONTACT_PRO_URL . 'includes/assets/js/contact-libraries.js');
	wp_enqueue_script('nino-contact-pro-form-builder-script', NINO_CONTACT_PRO_URL . 'includes/assets/js/contact-form-builder.js');
	wp_enqueue_script('nino-contact-pro-elements-settings-script', NINO_CONTACT_PRO_URL . 'includes/assets/js/contact-elements-settings.js');
}

function demo_contact_pro_admin_form_builder_load_scripts() {
	nino_contact_pro_admin_load_scripts();
	
	wp_enqueue_script('demo-contact-pro-form-builder-script', NINO_CONTACT_PRO_URL . 'includes/assets/js/demo-contact-form-builder.js');
}

add_action('admin_menu', 'nino_contact_pro_admin_actions');